package Algorithm;

public class LC704 {
    public int search(int[] nums, int target) {
        int i=0;
        int j=nums.length-1;
        while(i<=j){
            int mid=(j-i)/2+i;
            if(nums[mid]>target) j=mid-1;
            else if(nums[mid]<target) i=mid+1;
            else return mid;
        }
        return -1;
    }
}
